package fir.diagram.part;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.gef.Tool;
import org.eclipse.gef.palette.PaletteContainer;
import org.eclipse.gef.palette.PaletteGroup;
import org.eclipse.gef.palette.PaletteRoot;
import org.eclipse.gef.palette.ToolEntry;
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool;
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool;

import fir.diagram.providers.FirElementTypes;

/**
 * @generated
 */
public class FirPaletteFactory {

	/**
	 * @generated
	 */
	public void fillPalette(PaletteRoot paletteRoot) {
		paletteRoot.add(createElementos1Group());
		paletteRoot.add(createLinks2Group());
	}

	/**
	 * Creates "Elementos" palette tool group
	 * @generated
	 */
	private PaletteContainer createElementos1Group() {
		PaletteGroup paletteContainer = new PaletteGroup(
				Messages.Elementos1Group_title);
		paletteContainer.add(createFuncionalidade1CreationTool());
		paletteContainer.add(createInformacao2CreationTool());
		paletteContainer.add(createRegra3CreationTool());
		return paletteContainer;
	}

	/**
	 * Creates "Links" palette tool group
	 * @generated
	 */
	private PaletteContainer createLinks2Group() {
		PaletteGroup paletteContainer = new PaletteGroup(
				Messages.Links2Group_title);
		paletteContainer.add(createLinkRegraInformacao1CreationTool());
		paletteContainer.add(createLinkRegraFuncionalidade2CreationTool());
		paletteContainer.add(createLinkInformacaoRegra3CreationTool());
		return paletteContainer;
	}

	/**
	 * @generated
	 */
	private ToolEntry createFuncionalidade1CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(FirElementTypes.Funcionalidade_2002);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Funcionalidade1CreationTool_title,
				Messages.Funcionalidade1CreationTool_desc, types);
		entry.setSmallIcon(FirElementTypes
				.getImageDescriptor(FirElementTypes.Funcionalidade_2002));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createInformacao2CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(FirElementTypes.Informacao_2001);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Informacao2CreationTool_title,
				Messages.Informacao2CreationTool_desc, types);
		entry.setSmallIcon(FirElementTypes
				.getImageDescriptor(FirElementTypes.Informacao_2001));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createRegra3CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(FirElementTypes.Regra_2003);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Regra3CreationTool_title,
				Messages.Regra3CreationTool_desc, types);
		entry.setSmallIcon(FirElementTypes
				.getImageDescriptor(FirElementTypes.Regra_2003));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createLinkRegraInformacao1CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(FirElementTypes.LinkRegraInformacao_4003);
		LinkToolEntry entry = new LinkToolEntry(
				Messages.LinkRegraInformacao1CreationTool_title,
				Messages.LinkRegraInformacao1CreationTool_desc, types);
		entry.setSmallIcon(FirElementTypes
				.getImageDescriptor(FirElementTypes.LinkRegraInformacao_4003));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createLinkRegraFuncionalidade2CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(FirElementTypes.LinkRegraFuncionalidade_4001);
		LinkToolEntry entry = new LinkToolEntry(
				Messages.LinkRegraFuncionalidade2CreationTool_title,
				Messages.LinkRegraFuncionalidade2CreationTool_desc, types);
		entry
				.setSmallIcon(FirElementTypes
						.getImageDescriptor(FirElementTypes.LinkRegraFuncionalidade_4001));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createLinkInformacaoRegra3CreationTool() {
		List/*<IElementType>*/types = new ArrayList/*<IElementType>*/(1);
		types.add(FirElementTypes.LinkInformacaoRegra_4002);
		LinkToolEntry entry = new LinkToolEntry(
				Messages.LinkInformacaoRegra3CreationTool_title,
				Messages.LinkInformacaoRegra3CreationTool_desc, types);
		entry.setSmallIcon(FirElementTypes
				.getImageDescriptor(FirElementTypes.LinkInformacaoRegra_4002));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private static class NodeToolEntry extends ToolEntry {

		/**
		 * @generated
		 */
		private final List elementTypes;

		/**
		 * @generated
		 */
		private NodeToolEntry(String title, String description,
				List elementTypes) {
			super(title, description, null, null);
			this.elementTypes = elementTypes;
		}

		/**
		 * @generated
		 */
		public Tool createTool() {
			Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
			tool.setProperties(getToolProperties());
			return tool;
		}
	}

	/**
	 * @generated
	 */
	private static class LinkToolEntry extends ToolEntry {

		/**
		 * @generated
		 */
		private final List relationshipTypes;

		/**
		 * @generated
		 */
		private LinkToolEntry(String title, String description,
				List relationshipTypes) {
			super(title, description, null, null);
			this.relationshipTypes = relationshipTypes;
		}

		/**
		 * @generated
		 */
		public Tool createTool() {
			Tool tool = new UnspecifiedTypeConnectionTool(relationshipTypes);
			tool.setProperties(getToolProperties());
			return tool;
		}
	}
}
